Upgrade qpcr and seqlib modules from Python 2 to Python 3.12#1
Merged
Upgrade qpcr and seqlib modules from Python 2 to Python 3.12#1
Conversation
- Fix print statements to print() functions - Update integer division and string handling - Modernize dict.keys()/values()/items() usage - Fix exception syntax (except X as e) - Update urllib/urllib2 imports for Python 3 - Fix other Python 2→3 compatibility issues - Add pyproject.toml and requirements.txt https://claude.ai/code/session_01CVzyi7WGAKyTJzbmnSNF6r
- Expand README with installation, usage examples, and module reference table - Replace seqlib/__init__.py SHRiMP pipeline stub with proper package docstring and __all__ export list; add __version__ - Expand qpcr/__init__.py to expose all submodules (abi, MinerMethod, qpcrAnalysis, util); add __version__ - Add tests/ with smoke tests for all qpcr and seqlib public modules - Add .github/workflows/ci.yml: lint (ruff) + test matrix (Python 3.12/3.13) - Add .pre-commit-config.yaml with ruff and pre-commit-hooks - Add ruff, pytest, and coverage config sections to pyproject.toml - Pin dependency upper bounds in requirements.txt; add ruff/pre-commit as dev deps - Add CHANGELOG.md and CONTRIBUTING.md with development guidelines - Remove dead rasmus try/except imports from seqlib/util.py - Wrap pygr imports in genomelib.py and pygrlib.py with try/except ImportError - Fix bare `import sequencelib` → relative import in genomelib.py - Remove executable-at-import code from pygrlib.py (was a scratch script) https://claude.ai/code/session_01CVzyi7WGAKyTJzbmnSNF6r
- Switch build-backend from setuptools.backends.legacy to setuptools.build_meta
(legacy backend requires newer pip not available in all CI environments)
- Move rpy2 to optional [r] extra; add pandas as core dependency
- Add pytest.importorskip("rpy2") guards for seqstats, RIPDiff, JensenShannon,
mySam, Chip, continuousData tests (these modules import rpy2 at module level)
- Fix remaining Python 2 syntax in sequencelib.py:
- raise "string", arg → raise ValueError(...)
- print "%d" % x → print("%d" % x)
- import prob → from . import prob (bare sibling import)
- Fix remaining Python 2 syntax in solid.py:
- import misc → from . import misc
- print >>outhand, ... → outhand.write(...)
- print "...", / print "" → print(...)
- dict.has_key() → in operator
- Fix invalid regex escape sequence in util.py (\$ → r-string)
- Update requirements.txt to comment out rpy2 (now optional)
- Add ruff to dev dependencies in pyproject.toml
All 21 tests now pass (6 skipped without rpy2/R installed).
https://claude.ai/code/session_01CVzyi7WGAKyTJzbmnSNF6r
…ruff errors
- Run 2to3 print fixer on smRNA, lincClonelib, lincName, lincRNAs, dbConn,
go, gibson, genomelib, primer3lib (print >>stream, expr → print(..., file=...))
- Fix remaining Python 2 except A, B: syntax → except A as B: in
gibson.py, lincClonelib.py, lincName.py
- Fix backtick repr expressions (`expr` → repr(expr)) in myDataTypes.py
- Fix <> operator remaining in shrimp.py
- Fix raise 'string', arg → raise error('arg') in myDataTypes.py
- Fix bare import sequencelib → from . import sequencelib in smRNA.py
- Fix E731: convert lambda assignment to def in algorithms.py
- Fix E702: split semicolon-separated statements in util.py
- Fix F507: wrong number of % format args in primer3lib.py
- Fix F823: rename loop variable 'next' → 'nxt' in mySam.py (was shadowing builtin)
- Fix E402 in smRNA.py: merge dangling docstring into module docstring
- Add noqa: E402 to misc.py late import (intentional for code organization)
- Expand ruff ignore list: add E101, E402, E731 suppressed for legacy code
- Remove .bak files left by lib2to3 (via .gitignore)
ruff check src/ now passes with 0 errors.
pytest: 21 passed, 6 skipped (rpy2 not installed).
https://claude.ai/code/session_01CVzyi7WGAKyTJzbmnSNF6r
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://claude.ai/code/session_01CVzyi7WGAKyTJzbmnSNF6r